//
//  HeroBeauty.cpp
//  FruitCrush
//
//  Created by wuliqing on 15/8/12.
//
//

#include "HeroBeauty.h"
static HeroBeauty *mHeroBeauty = nullptr;

HeroBeauty* HeroBeauty::getInstance()
{
    if (!mHeroBeauty)
    {
    	mHeroBeauty = new HeroBeauty();
    }

    return mHeroBeauty;
}

HeroBeauty::HeroBeauty()
{
	healthLevelValue = UserDefault::getInstance()->getIntegerForKey("healthLevelValue-beauty");
	healthValue = HEALTH_BASE + healthLevelValue * HEALTH_CEAL;
	swordLevelValue = UserDefault::getInstance()->getIntegerForKey("swordLevelValue-beauty");
	swordValue = ATTACK_BASE + swordLevelValue * ATTACK_CEAL;
	fireLevelValue = UserDefault::getInstance()->getIntegerForKey("fireLevelValue-beauty");
	fireValue = ATTACK_BASE + fireLevelValue * ATTACK_CEAL;
	arrowLevelValue = UserDefault::getInstance()->getIntegerForKey("arrowLevelValue-beauty");
	arrowValue = ATTACK_BASE + arrowLevelValue * ATTACK_CEAL;
	lightLevelValue = UserDefault::getInstance()->getIntegerForKey("lightLevelValue-beauty");
	lightValue = ATTACK_BASE + lightLevelValue * ATTACK_CEAL;

	healthGlodValue = UserDefault::getInstance()->getIntegerForKey("healthGlodValue-beauty",GLOD_CEAL);
	swordGlodValue = UserDefault::getInstance()->getIntegerForKey("swordGlodValue-beauty",GLOD_CEAL);
	fireGlodValue = UserDefault::getInstance()->getIntegerForKey("fireGlodValue-beauty",GLOD_CEAL);
	arrowGlodValue = UserDefault::getInstance()->getIntegerForKey("arrowGlodValue-beauty",GLOD_CEAL);
	lightGlodValue = UserDefault::getInstance()->getIntegerForKey("lightGlodValue-beauty",GLOD_CEAL);
}

HeroBeauty::~HeroBeauty(void)
{
	mHeroBeauty = nullptr;
}

void HeroBeauty::setArrowLevelValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("arrowLevelValue-beauty");
	UserDefault::getInstance()->setIntegerForKey("arrowLevelValue-beauty", value + 1);
	arrowLevelValue = UserDefault::getInstance()->getIntegerForKey("arrowLevelValue-beauty");
	arrowValue = ATTACK_BASE + arrowLevelValue * ATTACK_CEAL;
}
void HeroBeauty::setFireLevelValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("fireLevelValue-beauty");
	UserDefault::getInstance()->setIntegerForKey("fireLevelValue-beauty", value + 1);
	fireLevelValue = UserDefault::getInstance()->getIntegerForKey("fireLevelValue-beauty");
	fireValue = ATTACK_BASE + fireLevelValue * ATTACK_CEAL;
}
void HeroBeauty::setHealthLevelValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("healthLevelValue-beauty");
	UserDefault::getInstance()->setIntegerForKey("healthLevelValue-beauty", value + 1);
	healthLevelValue = UserDefault::getInstance()->getIntegerForKey("healthLevelValue-beauty");
	healthValue = HEALTH_BASE + healthLevelValue * HEALTH_CEAL;
}
void HeroBeauty::setLightLevelValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("lightLevelValue-beauty");
	UserDefault::getInstance()->setIntegerForKey("lightLevelValue-beauty", value + 1);
	lightLevelValue = UserDefault::getInstance()->getIntegerForKey("lightLevelValue-beauty");
	lightValue = ATTACK_BASE + lightLevelValue * ATTACK_CEAL;
}
void HeroBeauty::setSwordLevelValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("swordLevelValue-beauty");
	UserDefault::getInstance()->setIntegerForKey("swordLevelValue-beauty", value + 1);
	swordLevelValue = UserDefault::getInstance()->getIntegerForKey("swordLevelValue-beauty");
	swordValue = ATTACK_BASE + swordLevelValue * ATTACK_CEAL;
}
void HeroBeauty::setHealthGlodValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("healthGlodValue-beauty",GLOD_CEAL);
	UserDefault::getInstance()->setIntegerForKey("healthGlodValue-beauty", value + GLOD_CEAL);
	healthGlodValue = value + GLOD_CEAL;
}
void HeroBeauty::setSwordGlodValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("swordGlodValue-beauty",GLOD_CEAL);
	UserDefault::getInstance()->setIntegerForKey("swordGlodValue-beauty", value + GLOD_CEAL);
	swordGlodValue = value + GLOD_CEAL;
}
void HeroBeauty::setFireGlodValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("fireGlodValue-beauty",GLOD_CEAL);
	UserDefault::getInstance()->setIntegerForKey("fireGlodValue-beauty", value + GLOD_CEAL);
	fireGlodValue = value + GLOD_CEAL;
}
void HeroBeauty::setArrowGlodValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("arrowGlodValue-beauty",GLOD_CEAL);
	UserDefault::getInstance()->setIntegerForKey("arrowGlodValue-beauty", value + GLOD_CEAL);
	arrowGlodValue = value + GLOD_CEAL;
}
void HeroBeauty::setLightGlodValue(int var){
	int value = UserDefault::getInstance()->getIntegerForKey("lightGlodValue-beauty",GLOD_CEAL);
	UserDefault::getInstance()->setIntegerForKey("lightGlodValue-beauty", value + GLOD_CEAL);
	lightGlodValue = value + GLOD_CEAL;
}

